﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using Final.App_Code;
using System.Data;

namespace Final
{
    public partial class change_subj_confirmation : System.Web.UI.Page
    {

        protected void confirmButton_Click(object sender, EventArgs e)
        {           
            Studentsubject_allocation sa = new Studentsubject_allocation();

            sa.Studentid = lbl_studentid.Text;
            sa.Priority = lbl_sub1.Text;
            sa.Priority2 = lbl_sub2.Text;
            sa.Priority3 = lbl_sub3.Text;
            sa.Submissiontime = System.DateTime.Now;
           
            sa.Subjectcode = Session["sub1code"].ToString();
            sa.Subjectcode2 = Session["sub2code"].ToString();
            sa.Subjectcode3 = Session["sub3code"].ToString();

            Studentsubject_allocation.insertstudentsubjectAllocation(sa);
            Studentsubject_allocation.insertstudentsubjectAllocationrow2(sa);
            Studentsubject_allocation.insertstudentsubjectAllocationrow3(sa);

            string alertScript = String.Format("<Script Language='javascript'> alert('{0}');</script>", "Subject selection completed successfully !");
            Page.ClientScript.RegisterStartupScript(this.GetType(), "Key", alertScript, false);   
        }

        protected void Page_Load(object sender, EventArgs e)
        {

            lbl_studentid.Text = Session["id"].ToString();

            if (Session["sub1"] != null)
                lbl_sub1.Text = Session["sub1"].ToString();


            if (Session["sub2"] != null)
                lbl_sub2.Text = Session["sub2"].ToString();

            if (Session["sub3"] != null)
                lbl_sub3.Text = Session["sub3"].ToString();

        }

        protected void editButton_Click(object sender, EventArgs e)
        {
            editButton.Attributes.Add("onClick", "javascript:history.go(-1); return false;");
        }
    }
}